
<?php 
		$filepath = Yii::app()->params['uploadGalleryPath'];
		foreach ($thumbnails as $model){
			$destination =  $filepath.date('Y',$model->file_created).'/'.date('m',$model->file_created).'/'.date('d',$model->file_created).'/'.$model->file_links.'.'.$model->file_ext;
			$thumb_destination  =  $filepath.date('Y',$model->file_created).'/'.date('m',$model->file_created).'/'.date('d',$model->file_created).'/'.$model->file_links.'_thumb.'.$model->file_ext;
			$img = CHtml::image($thumb_destination,$model->file_name,array('class'=>'thumb_img_sub','id'=>$model->file_id,'width'=>90,'style'=>'padding:5px;'));
			echo CHtml::link($img,array('#'),array('style'=>'width:100px; margin:5px;'));
		}
		echo "<div class=\"thumb_up\" style=\"float:right; background:yellow; curson:pointer;\">UP</div>";
?>
<script type="text/javascript">
<!--
	$(function(){
		
		$(".thumb_up").click(function(){
			$(this).parent().slideUp('slow');
		});
		$(".thumb_img_sub").click(function(){
			$("#Video_file_fid").val($(this).attr('id'));
			$("#Video_file_video_image").val($(this).attr('src'));
			
			$("#FileRemote_file_fid").val($(this).attr('id'));
			$("#FileRemote_file_video_image").val($(this).attr('src'));
			
			href = $(this).attr('src');
//			alert(href);
//			alert('<?php echo $_GET['pid'];?>');
			
			$.post('<?php echo $this->createurl('category/generatethumbnail');?>',{
				'id':'<?php echo $_GET['pid'];?>',
				'url':href
			},function(result){
				
				$("#cateFolder").attr("src", function() { 
					src = "<?php echo Yii::app()->params['uploadCategoryPath'].$this->getCategoryName($_GET['pid']);?>_thumb.jpg?r="+Math.random();
					return src; 
	       		 });
				alert(result);
			});
			
			return false;
		});
 	});
//-->
</script>	